home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / wtek0693.zip / OOPALLEY.ZIP / COLLECT.H < prev    next >
C/C++ Source or Header  |  1993-04-27  |  2KB  |  57 lines

  1. #ifndef COLLECTION_H
  2. #define COLLECTION_H
  3.  
  4. #include "object.h"
  5.  
  6. // default initial collection capacity
  7. const unsigned CLTN_DEFAULT_CAPACITY    = 16;
  8.  
  9. // collection (OrderedCltn) expansion increment
  10. const unsigned CLTN_EXPANSION_INCREMENT = 32;
  11.  
  12. // collection (Set,Bag,Dictionary) expansion factor
  13. const unsigned CLTN_EXPANSION_FACTOR = 2;
  14.  
  15. class ArrayOb;
  16. class Bag;
  17. class Iterator;
  18. class OrderedCltn;
  19. class Set;
  20. class SortedCltn;
  21.  
  22. extern const Class class_Collection;
  23.  
  24. ////////////////////////////////////////////////////////////
  25. // class Collection (declaration)
  26. ////////////////////////////////////////////////////////////
  27. class Collection: public Object {   // abstract class 
  28. protected:
  29.                 // protected constructor
  30.                 Collection() {}
  31. public:
  32.     ArrayOb                     asArrayOb() const;
  33.     Bag                         asBag() const;
  34.     OrderedCltn                 asOrderedCltn() const;
  35.     Set                         asSet() const;
  36.     SortedCltn                  asSortedCltn() const;
  37.     virtual Object*             add(const Object&);
  38.     virtual const Collection&   addAll(const Collection&);
  39.     virtual Collection&         addContentsTo(Collection&) const;
  40.     virtual Object*&            at(int) const;
  41.     virtual void                deepenShallowCopy();
  42.     virtual Object*             doNext(Iterator& pos) const;
  43.     virtual void                doReset(Iterator& pos) const;
  44.     virtual bool                includes(const Object&) const;
  45.     virtual const Class*        isA() const const;
  46.     virtual bool                isEmpty() const;
  47.     virtual unsigned            occurrencesOf(const Object&) const;
  48.     virtual Object*             remove(const Object&);
  49.     virtual const Collection&   removeAll(const Collection&);
  50.     virtual Object*             shallowCopy() const;      // shouldNotImplement
  51.     virtual unsigned            size() const;
  52. };
  53.  
  54. #include "Iterator.h"
  55.  
  56. #endif
  57.